/**
 * Created by meiguizhinian on 2018/7/6
 * Copyright © 2018 lixiaolong. All rights reserved.
 */

if (!cc.Scheduler.prototype.performFunctionInCocosThread) {
	cc.Scheduler.prototype._functionsToPerform = [];

	cc.Scheduler.prototype.performFunctionInCocosThread = function(fun) {
		this._functionsToPerform.push(fun);
	};

	cc.Scheduler.prototype.__update = cc.Scheduler.prototype.update;
	cc.Scheduler.prototype.update = function (dt) {
		this.__update(dt);
		if (this._functionsToPerform!==0) {
			let temp = this._functionsToPerform;
			this._functionsToPerform = [];
			for (let i=0; i!==temp.length; ++i) {
				temp[i]();
			}
		}
	}
}
